import request from '@/utils/request'

// 分校管理---根据编号查询分校
export function selectByConditions(query) {
  return request({
    url: '/jbl-business/api/merchant/v1/business/selectByConditions',
    method: 'get',
    params: query
  })
}
// 机构推广码
export function QRcode(query) {
  return request({
    url: '/jbl-business/api/merchant/v1/business/QRcode',
    method: 'get',
    params: query
  })
}
// 分校管理-------根据机构编号查询校长
export function selectPrincipalListByOrgId(query) {
  return request({
    url: '/jbl-user-center/api/merchant/v1/sysUser/selectPrincipalListByOrgId',
    method: 'get',
    params: query
  })
}

// 员工-新增校长
export function addPrincipal(query) {
  return request({
    url: '/jbl-user-center/api/merchant/v1/sysUser/add',
    method: 'post',
    data: query
  })
}

// 分校管理-------启用禁用校长
export function updatePrincipalStatus(query) {
  return request({
    url: '/jbl-user-center/api/merchant/v1/sysUser/updatePrincipalStatus',
    method: 'get',
    params: query
  })
}

// 机构分类
export function merchantType(query) {
  return request({
    url: '/jbl-business/api/v1/category/getByParentId',
    method: 'get',
    params: query
  })
}

// 查询所有的分类包含父分类和子分类
export function getCategoryAll(query) {
  return request({
    url: '/jbl-business/api/v1/category/getCategoryAll',
    method: 'get',
    params: query
  })
}

// 获取所有标签
export function getAllLabels(query) {
  return request({
    url: '/jbl-business/api/merchant/v1/label/getByConditions',
    method: 'get',
    params: query
  })
}

// 分校管理------添加分校
export function addBusines(query) {
  return request({
    url: '/jbl-business/api/merchant/v1/business/add',
    method: 'post',
    data: query
  })
}
// 分校管理------修改分校
export function updateById(query) {
  return request({
    url: '/jbl-business/api/merchant/v1/business/updateById',
    method: 'post',
    data: query
  })
}

// 分校管理---根据编号查询机构详情
export function getById(query) {
  return request({
    url: '/jbl-business/api/merchant/v1/business/getById',
    method: 'get',
    params: query
  })
}

// 上下架分校
export function dismountGrounding(query) {
  return request({
    url: '/jbl-business/api/merchant/v1/business/dismountGrounding',
    method: 'get',
    params: query
  })
}

// 提现账户管理---------根据机构编号和提现账户类型查询
export function getByBusinessAndType(query) {
  return request({
    url: '/jbl-business/api/v1/capitalAccount/getByBusinessAndType',
    method: 'get',
    params: query
  })
}

// 提现账户管理---------解绑提现账户
export function deleteByBusinessAndType(query) {
  return request({
    url: '/jbl-business/api/v1/capitalAccount/delete',
    method: 'get',
    params: query
  })
}

// 提现管理-----根据unionId和机构编号查询绑定的信息
export function getByUnionIdAndBusiness(query) {
  return request({
    url: '/jbl-business/api/v1/capitalAccount/getByUnionIdAndBusiness',
    method: 'get',
    params: query
  })
}

// 提现账户管理------绑定微信提现账户
export function capitalAccount(query) {
  return request({
    url: '/jbl-business/api/v1/capitalAccount/add',
    method: 'post',
    data: query
  })
}

// 机构列表
export function merchantList(query) {
  return request({
    url: '/jbl-business/api/admin/v1/business/select/page',
    method: 'get',
    params: query
  })
}

// 更改机构状态
export function merchantStatus(query) {
  return request({
    url: '/jbl-business/api/admin/v1/business/dismountGrounding',
    method: 'get',
    params: query
  })
}